import axios from '@/utils/request'
// import { getStorageToken } from '@/utils/storage'

/**
 *
 * @param {*} payload 手机号和密码
 * @returns
 */
export const getUserInfo = (payload) =>
  axios({
    method: 'POST',
    url: '/index/login',
    data: {
      mobile: payload.mobile,
      password: payload.password
    }
  })

/**
 *
 * @param {*} mobile
 * @param {*} password
 * @returns
 */
export const regUserInfo = (mobile, password) =>
  axios({
    method: 'POST',
    url: '/index/reg',
    data: {
      mobile,
      password
    }
  })

/**
 *
 * @returns 获取用户信息
 */
export const getUser = () => axios.get('/user/getUserInfo')

/** 修改用户信息
 *
 * @param {*} data 传入对象
 * @returns
 */
export const alterUserInfo = (data) =>
  axios({
    method: 'POST',
    url: '/user/update',
    data
  })

export const tou = (data) =>
  axios({
    method: 'POST',
    url: '/common/upload?type=images',
    // headers: {
    //   'x-token': getStorageToken()
    // },
    data,
    contentType: false,
    processData: false
  })
